package com.durian.finance.service.impl;

import com.durian.common.core.utils.DateUtils;
import com.durian.financial.api.domain.Bank;
import com.durian.finance.mapper.BankMapper;
import com.durian.finance.service.IBankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 银行代码Service业务层处理
 * 
 * @author durian
 * @date 2022-06-26
 */
@Service
public class BankServiceImpl implements IBankService 
{
    @Autowired
    private BankMapper bankMapper;

    /**
     * 查询银行代码
     * 
     * @param id 银行代码主键
     * @return 银行代码
     */
    @Override
    public Bank selectBankById(Long id)
    {
        return bankMapper.selectBankById(id);
    }

    /**
     * 查询银行代码列表
     * 
     * @param bank 银行代码
     * @return 银行代码
     */
    @Override
    public List<Bank> selectBankList(Bank bank)
    {
        return bankMapper.selectBankList(bank);
    }

    /**
     * 新增银行代码
     * 
     * @param bank 银行代码
     * @return 结果
     */
    @Override
    public int insertBank(Bank bank)
    {
        bank.setCreateTime(DateUtils.getNowDate());
        return bankMapper.insertBank(bank);
    }

    /**
     * 修改银行代码
     * 
     * @param bank 银行代码
     * @return 结果
     */
    @Override
    public int updateBank(Bank bank)
    {
        bank.setUpdateTime(DateUtils.getNowDate());
        return bankMapper.updateBank(bank);
    }

    /**
     * 批量删除银行代码
     * 
     * @param ids 需要删除的银行代码主键
     * @return 结果
     */
    @Override
    public int deleteBankByIds(Long[] ids)
    {
        return bankMapper.deleteBankByIds(ids);
    }

    /**
     * 删除银行代码信息
     * 
     * @param id 银行代码主键
     * @return 结果
     */
    @Override
    public int deleteBankById(Long id)
    {
        return bankMapper.deleteBankById(id);
    }

}
